package cn.wolfcode.trip.base.domain;


import com.alibaba.druid.support.json.JSONUtils;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Setter
@Getter
/**
 * 大攻略
 */
public class Strategy extends BaseDomain {

    public static final Integer STATE_NORMAL = 1;//正常
    public static final Integer STATE_HOT = 2;//推荐
    public static final Integer STATE_DISABLE = 3;//状态

    //攻略的地区
    private Region place;
    //标题
    private String title;
    //副标题
    private String subTitle;
    //封面
    private String coverUrl;
    //状态
    private Integer state = STATE_NORMAL;

    public String getStateName(){
        if(state==STATE_NORMAL){
            return "正常";
        }else if(state==STATE_HOT){
            return "推荐";
        }else if(state==STATE_DISABLE){
            return "禁用";
        }
        return "";
    }

    public String getJSONString(){
        Map<String,Object> map = new HashMap<String,Object>();

        map.put("id",id );
        map.put("title",title );
        map.put("subTitle",subTitle );
        map.put("coverUrl",coverUrl );
        if(place!=null){
            map.put("placeId",place.id );
        }
        map.put("state",state );

        return JSONUtils.toJSONString(map);

    }


}